package com.groupsix.controller;

import com.groupsix.pojo.SysUser;
import com.groupsix.service.UserService;
import com.groupsix.vo.LoginInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
public class UserController {
    @Autowired
    private UserService userService;
    @ResponseBody
    @RequestMapping("isMy")
    public SysUser findUser(HttpSession session){
        int uid = (int)session.getAttribute("uid");
        SysUser user = userService.findUserById(uid);
        System.out.println("user = " + user);
        return user;
    }
}
